package cn.edu.xust.controller;

import cn.edu.xust.entity.DeviceEntity;
import cn.edu.xust.service.DeviceService;
import cn.edu.xust.service.ElecdataService;
import cn.edu.xust.service.WtdataService;
import cn.edu.xust.util.R;
import cn.edu.xust.util.RedisUtil;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @author ufo
 * @email 2575829997@qq.com
 * @date 2024-03-27 18:09:23
 */
@RestController
@RequestMapping("/device")
public class DeviceController {
    @Autowired
    private DeviceService deviceService;
    @Autowired
    private RedisUtil redisUtil;
    @Autowired
    private ElecdataService elecdatas;
    @Autowired
    private WtdataService wtdataService;
    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam(value = "sign") String sign, @RequestBody JSONObject jsonObject) {
        String hotelid = jsonObject.getString("hotelid");
        String roomname = jsonObject.getString("roomname");
        List<DeviceEntity> byHotelRoom = deviceService.getByHotelRoom(hotelid, roomname);
        return R.ok().put("data", byHotelRoom);
    }


}
